#include "Iterator.hpp"
#include "Iterator.cpp"
#include "DysList.hpp"
#include "DysList.cpp"

#include <iostream>
using namespace std;

int main(int argc, char const *argv[])
{
    DysList<int> *mylist = new DysList<int>();
    mylist->add(1);
    mylist->add(2);
    mylist->add(3);
    mylist->add(5);
    mylist->add(7);
    cout << "使用普通方式遍历列表：" << endl;
    for (int i = 0; i < mylist->size(); i++)
    {
        cout << "idx: " << i << ", value: " << mylist->get(i) << endl;
    }
    cout << "使用迭代器方式遍历列表：" << endl;
    Iterator<int> *iterator = mylist->getIterator();
    while (iterator->hasNext())
    {
        int item = iterator->next();
        cout << "value: " << item << endl;
    }
    delete mylist;
    return 0;
}
